home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Periodicals / CSMP / C.S.M.P. Digest, Issue 3.004 < prev    next >
Internet Message Format  |  1994-06-09  |  54KB

  1. From: pottier@clipper.ens.fr (Francois Pottier)
  2. Subject: C.S.M.P. Digest, Issue 3.004
  3. Date: Tue, 15 Mar 94 16:31:03 MET
  4.  
  5. C.S.M.P. Digest             Tue, 15 Mar 94       Volume 3 : Issue 4
  6.  
  7. Today's Topics:
  8.  
  9.         Code optimization
  10.         Getting Started with TCL
  11.         How would you write a text-based log window?
  12.         Reducing screen flicker in simple animation.
  13.         What to say when the appropiate Gestalts aren't there?
  14.         small snag
  15.  
  16.  
  17.  
  18. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  19. (pottier@clipper.ens.fr).
  20.  
  21. The digest is a collection of article threads from the internet newsgroup
  22. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  23. regularly and want an archive of the discussions.  If you don't know what a
  24. newsgroup is, you probably don't have access to it.  Ask your systems
  25. administrator(s) for details.  If you don't have access to news, you may
  26. still be able to post messages to the group by using a mail server like
  27. anon.penet.fi (mail help@anon.penet.fi for more information).
  28.  
  29. Each issue of the digest contains one or more sets of articles (called
  30. threads), with each set corresponding to a 'discussion' of a particular
  31. subject.  The articles are not edited; all articles included in this digest
  32. are in their original posted form (as received by our news server at
  33. nef.ens.fr).  Article threads are not added to the digest until the last
  34. article added to the thread is at least two weeks old (this is to ensure that
  35. the thread is dead before adding it to the digest).  Article threads that
  36. consist of only one message are generally not included in the digest.
  37.  
  38. The digest is officially distributed by two means, by email and ftp.
  39.  
  40. If you want to receive the digest by mail, send email to listserv@ens.fr
  41. with no subject and one of the following commands as body:
  42.     help                        Sends you a summary of commands
  43.     subscribe csmp-digest Your Name    Adds you to the mailing list
  44.     signoff csmp-digest            Removes you from the list
  45. Once you have subscribed, you will automatically receive each new
  46. issue as it is created.
  47.  
  48. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  49. Questions related to the ftp site should be directed to
  50. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  51. digest are available there.
  52.  
  53. Also, the digests are available to WAIS users as comp.sys.mac.programmer.src.
  54.  
  55.  
  56. -------------------------------------------------------
  57.  
  58. >From alex@metcalf.demon.co.uk (Alex Metcalf)
  59. Subject: Code optimization
  60. Date: Sun, 27 Feb 1994 23:49:17 GMT
  61. Organization: Demon Internet
  62.  
  63.  
  64.         I'm working on an arcade game which, when being played, goes
  65. through a "loop" of code every 2 ticks. In this time, it's calling various
  66. functions, doind some calculations, then copying graphics to the screen.
  67.  
  68.         Since it's only just keeping up on my LC475 (!), I need to optimise
  69. my code so that it works comfortably on 68030 Macs. I want to find out how
  70. long each function call in my loop is taking, but obviously, checking the
  71. ticks won't work. A resolution of time such as 10ths of a tick would be
  72. useful. I can see that I'm going to have to use the Time manager (is that
  73. what it's called?), but I get the impression that it will be more work than
  74. it's worth to implement.
  75.  
  76.         If this task proves hard, could someone give me some suggestions as
  77. to how I could improve the following operations?
  78.  
  79. • Copying 24 x 24 pixel graphics to the window (using CopyBits and
  80. CopyMask)
  81. • Dividing numbers (I'm using, e.g. bigNum/littleNum)
  82. • Copying between GWorlds (all 8 bit, 640x480; I'm using CopyBits /
  83. CopyMask).
  84.  
  85.         I'd like faster routines, if possible, but I don't want them if it
  86. means compromising compatibility with other (or future) Macs. That'll be
  87. the day.. :-)
  88.  
  89.         Thanks,
  90.  
  91.  
  92.  
  93.         Alex
  94.  
  95. --
  96. Alex Metcalf, Mac programmer in C, C++, HyperTalk, assembler
  97.  
  98. Internet, AOL, BIX:     alex@metcalf.demon.co.uk
  99. AppleLink:              alex@metcalf.demon.co.uk@internet#
  100. CompuServe:             INTERNET:alex@metcalf.demon.co.uk
  101. Delphi:                 alex@metcalf.demon.co.uk@inet#
  102. FirstClass:             alex@metcalf.demon.co.uk,Internet
  103. Fax (UK):               (0570) 45636
  104. Fax (US / Canada):      011 44 570 45636
  105.  
  106. +++++++++++++++++++++++++++
  107.  
  108. >From ejohnson@netcom.com (Eric Johnson)
  109. Date: Mon, 28 Feb 1994 00:57:33 GMT
  110. Organization: NETCOM On-line Communication Services (408 241-9760 guest)
  111.  
  112. Alex Metcalf (alex@metcalf.demon.co.uk) wrote:
  113.  
  114. > If this task proves hard, could someone give me some suggestions as
  115. > to how I could improve the following operations? 
  116.  
  117. > Copying 24 x 24 pixel graphics to the window (using CopyBits and
  118. > CopyMask) 
  119. > Dividing numbers (I'm using, e.g. bigNum/littleNum)
  120. > Copying between GWorlds (all 8 bit, 640x480; I'm using CopyBits /
  121. > CopyMask).
  122.  
  123. I wrote my own CopyBits for a game that I was writing.  I can dig it
  124. out and post it here.  I can give you the following suggestions
  125. though.
  126.  
  127. If you've created your icons with ResEdit, you should load them into a
  128. gWorld whose color table is the same one that you will eventually
  129. display your icons.  This will speed up the process because you will
  130. not have to worry about "recoloring" your icons into the new table.
  131. Consider this gWorld your palette of icons from which you will copy.
  132.  
  133. Then, you need to roll your own CopyBits.  You can optimize the hell
  134. out of this by creating a loop that uses a nice Motorola 680x0
  135. instruction that will decrease a data register, and branch if the data
  136. register is still not zero.  Its a good instruction to use, because it
  137. assumes that the jump will occur, and not flush the pipeline.  I'll be
  138. damned if I can remember the exact name of this instruction.  It
  139. starts with a d, I think.  Sorry, I just can't remember.  If you don't
  140. have a  Motorola 68030 or 68040 book, now is the time to get one.
  141.  
  142. You should construct the loop so that it will fill up the instruction
  143. cache, or at least use most of it.  That way, when the first run
  144. through of the loop occurs, the code will find its way into the
  145. instruction cache.  On the second run of the loop, its all in the
  146. cache so it runs like a champ.
  147.  
  148. You might also get better performance in your loop by reading in as
  149. much data as you can into the data registers.  Then, write it to the
  150. destination buffer in one swoop.  I think this might help a touch
  151. because you should be able to maximize the performance of the data
  152. registers.
  153.  
  154. There are some other optimizations that I made, but I don't remember.
  155. I'll have to dig out that code for you.  It was pretty damn fast.  It
  156. should be a bit faster for you, because you shouldn't need any
  157. masking.  I suppose others might find it useful too, so I'll get
  158. around to posting it.  My only request is that I get credit in
  159. someone's about box.
  160.  
  161. -Eric
  162. -- 
  163. Eric E Johnson
  164. ejohnson@netcom.netcom.com   
  165.  
  166. +++++++++++++++++++++++++++
  167.  
  168. >From al@crucible.powertools.com (Al Evans)
  169. Date: 28 Feb 94 17:12:02 GMT
  170. Organization: PowerTools, Austin, Texas
  171.  
  172. In article <alex-270294234959@metcalf.demon.co.uk> alex@metcalf.demon.co.uk (Alex Metcalf) writes:
  173.  
  174. >I can see that I'm going to have to use the Time manager (is that
  175. >what it's called?), but I get the impression that it will be more work than
  176. >it's worth to implement.
  177.  
  178. Actually, it's not difficult. Set up a Time Manager task that calls
  179. back every millisecond, and have the task increment a field in your
  180. (extended) Time Manager record. Look at this field before and after
  181. your function call. The difference is how long the function took to
  182. execute. 
  183.  
  184. >% Copying 24 x 24 pixel graphics to the window (using CopyBits and
  185. >CopyMask)
  186. >% Dividing numbers (I'm using, e.g. bigNum/littleNum)
  187. >% Copying between GWorlds (all 8 bit, 640x480; I'm using CopyBits /
  188. >CopyMask).
  189.  
  190. If I recall correctly, CopyBits with a mask region is substantially
  191. faster than CopyMask. But you should try to set up your copying
  192. such only the final copy is offscreen-to-onscreen, and this copy
  193. can be made with a call to CopyBits in srcCopy mode. Then, for
  194. your offscreen-to-offscreen copying, you can write your own masked
  195. copy routine optimized for 24X24 graphics.
  196.  
  197.                     --Al Evans--
  198. -- 
  199.  
  200. Al Evans                         Tu causes, tu causes
  201. al@crucible.powertools.com               C'est tout ce que tu sais faire
  202. cs.utexas.edu!crucible!al                     -- LaVerdure
  203.  
  204. ---------------------------
  205.  
  206. >From darick@zippy.nimh.nih.gov (Darick DeHart)
  207. Subject: Getting Started with TCL
  208. Date: Mon, 28 Feb 1994 14:49:56 GMT
  209. Organization: RSB/NIH
  210.  
  211. I have been struggling with Think Class Library for about a week.  I am a
  212. good C programmer with some experience in both Macintosh and Object
  213. Oriented programming.  I am hoping that mastering TCL will allow me to
  214. quickly develop simple Macintosh Applications.  
  215.  
  216. Are there any books (besides the Symantec TCL Guide) that provide "Getting
  217. Started" type information.  
  218.  
  219. I'm also interested in people's opinions on TCL.  Is learning it worth the
  220. investment in time?  How long does it take to become comfortable with the
  221. library?
  222.  
  223. +++++++++++++++++++++++++++
  224.  
  225. >From murphybf@rtsg.mot.com (Brendan F. Murphy)
  226. Date: 28 Feb 1994 18:58:15 GMT
  227. Organization: Motorola Cellular
  228.  
  229. In article <darick-280294085521@terrapin.ninds.nih.gov>, you write:
  230. |> I have been struggling with Think Class Library for about a week.  I am a
  231. |> good C programmer with some experience in both Macintosh and Object
  232. |> Oriented programming.  I am hoping that mastering TCL will allow me to
  233. |> quickly develop simple Macintosh Applications.  
  234.  
  235. What you say is true, but it takes a while to master TCL.  The trick is
  236. to not force TCL to do something it was not designed to do.  In other
  237. words, make your application fit TCL way of doing things and you'll be
  238. a much happier camper (until you become more experienced in TCL).
  239.  
  240. |> Are there any books (besides the Symantec TCL Guide) that provide "Getting
  241. |> Started" type information.  
  242.  
  243. There's the code!  I'm serious about that one!!  This is how you find
  244. out the deep dark secretes of TCL.
  245.  
  246. |> I'm also interested in people's opinions on TCL.  Is learning it worth the
  247. |> investment in time?  How long does it take to become comfortable with the
  248. |> library?
  249.  
  250. It all depends on the job you are trying to accomplish.  If your doing a
  251. medium to small application TCL may be the ticket for you.  If your
  252. doing something that's real industrial strength then MacApp might be
  253. the way to go.  I have found it to be worth learning and useful as a
  254. framework, but PowerPlant just might change my mind in the future when
  255. I get a hold of it.
  256.  
  257. There is a news group dedicated to to TCL called comp.sys.mac.oop.tcl
  258. and you might want to defer questions to that group.  Also there is an
  259. ftp site for a bunch of TCL classes at ftp.brown.edu.
  260.  
  261. Hope this helps.
  262.  
  263. +++++++++++++++++++++++++++
  264.  
  265. >From dent@perth.DIALix.oz.au (Andrew Dent)
  266. Date: 1 Mar 1994 17:36:10 +0800
  267. Organization: DIALix Services, Perth, Western Australia
  268.  
  269. Darick
  270.  
  271. Depending on what you are doing with TCL, you may want to escape from some
  272. of the hassles by using an interface editor/generator program.
  273.  
  274. Both AppMaker and Marksman generate excellent TCL code (immodest bit here:
  275. I wrote the Marksman TCL templates). I believe Marksman is better value for
  276. money and certainly the current version has better interface support, 
  277. including full color.
  278.  
  279. Marksman demos are available on most ftp sites that mirror info-mac or
  280. umich. The code demos are posted separately from the editor demo, which
  281. lets you do everything but save a prototype.
  282.  
  283. The TCL code demos should be on their way by now.
  284.  
  285. In general, my advice to TCL beginners is "relax and don't try to learn it
  286. all". You can do an amazing amount with TCL without having to learn too much
  287. about it's internals, until you need to change the standard behaviours.
  288.  
  289. Andy Dent (A.D. Software - Mac & VAX programming)
  290. 94 Bermuda Dve, BALLAJURA  Western Australia  6066
  291. Phone/Fax: 09 249 2719 (local)  +619 249 2719 (International)
  292.        Internet: dent@DIALix.oz.au    Compuserve: 100033,3241
  293.  
  294.  
  295. ---------------------------
  296.  
  297. >From egurney@vcd.hp.com (Eddy J. Gurney)
  298. Subject: How would you write a text-based log window?
  299. Date: Wed, 23 Feb 1994 23:39:46 GMT
  300. Organization: Hewlett-Packard VCD
  301.  
  302. I'm wondering if anyone has any suggestions to implementing a simple,
  303. fast, and effective read-only text-based log window. I have the need to
  304. have a window open to which I would write various status messages while
  305. the application runs. Since the this application could run for a lengthy
  306. period of time, I'd like the older data to be discarded for newer data
  307. when the buffer reaches some predetermined size.
  308.  
  309. Currently I'm using Eric Soldan's "TextEditControl" from Apple's
  310. DTS.Lib, and it works fairly well. (If anyone's interested, it was
  311. very simple to extract this complete TextEditControl from DTS.Lib to a
  312. completely "self contained" module which can be included in a THINK C
  313. application, giving you an editable text control in a window with no
  314. effort on your part.) I'm just wondering if there is a better solution.
  315. It should do all the normal TextEdit things like selecting text, scrolling
  316. while selecting, vertical scrollbar (horizontal is not necessary in my
  317. case), etc.
  318.  
  319. I'm just wondering if using TextEdit via Eric's TextEditControl is
  320. "overkill" and adding too much overhead to something which could be much
  321. simpler. (The slowest part right now is when the buffer fills up...
  322. in that case I do a TESetSelect to select some number of bytes, call
  323. TEDelete to remove them, TESetSelect to move to the end of the data and
  324. then TEInsert to add the new text.)
  325.  
  326. Any ideas or suggestions appreciated...
  327.  
  328. Thanks,
  329. Eddy
  330.  
  331. --
  332. Eddy J. Gurney N8FPW   Hewlett-Packard Company, Vancouver (USA!) Division
  333. egurney@vcd.hp.com                       #include <standard-disclaimer.h>
  334. "Failures are divided into two classes-- those who thought and never did,
  335.       and those who did and never thought."     John Charles Salak
  336.  
  337. +++++++++++++++++++++++++++
  338.  
  339. >From mxmora@unix.sri.com (Matt Mora)
  340. Date: 23 Feb 1994 17:04:04 -0800
  341. Organization: SRI International, Menlo Park, CA
  342.  
  343. In article <CLpB2B.AoJ@vcd.hp.com> egurney@vcd.hp.com (Eddy J. Gurney) writes:
  344. >I'm wondering if anyone has any suggestions to implementing a simple,
  345. >fast, and effective read-only text-based log window. I have the need to
  346. >have a window open to which I would write various status messages while
  347. >the application runs. Since the this application could run for a lengthy
  348. >period of time, I'd like the older data to be discarded for newer data
  349. >when the buffer reaches some predetermined size.
  350.  
  351. If you don't really need character level selection (ie line level selection 
  352. would suffice), use the list manager. I've wrote a dataviewer program
  353. that display large amounts of text in a scrolling list and it supports
  354. tab stops. My intent was to create a freeware document maker/viewer. 
  355. Using the list manager is easy and fun. Ldef's are easy to write just keep
  356. the data out of the list manager.
  357.  
  358. Another program I wrote called more or less displays large amounts of text
  359. by using drawtext. I intend to make both programs support PPC and or
  360. AppleEvents so that programmers can pipe debugging output these programs
  361. and have a easy to use log. No muss no fuss AEprintf/AEwriteln. :-)
  362.  
  363.  
  364.  
  365. Xavier
  366.  
  367.  
  368. -- 
  369. ___________________________________________________________
  370. Matthew Xavier Mora                    Matt_Mora@qm.sri.com
  371. SRI International                       mxmora@unix.sri.com
  372. 333 Ravenswood Ave                    Menlo Park, CA. 94025
  373.  
  374. +++++++++++++++++++++++++++
  375.  
  376. >From walrathw@rferl.org (WalrathW)
  377. Date: 28 Feb 94 11:05:50 -0500
  378. Organization: RFE/RL Inc.
  379.  
  380. In article <CLpB2B.AoJ@vcd.hp.com>
  381. egurney@vcd.hp.com (Eddy J. Gurney) writes:
  382.  
  383. > I'm wondering if anyone has any suggestions to implementing a simple,
  384. > fast, and effective read-only text-based log window. I have the need to
  385. > have a window open to which I would write various status messages while
  386. > the application runs. Since the this application could run for a lengthy
  387. > period of time, I'd like the older data to be discarded for newer data
  388. > when the buffer reaches some predetermined size.
  389. [deleted]
  390. > Any ideas or suggestions appreciated...
  391. > Thanks,
  392. > Eddy
  393.  
  394. I'm taking the advice suggested in a develop article several issues
  395. back, and using the Terminal Manager for simple debugging info. I've
  396. got a serial port capture application which only sends the data to
  397. files, but I added support for piping it to a TM window as well, to see
  398. what's supposed to end up in the files.
  399.  
  400. You might checkout DebugWindow library.  Here's some info from the
  401. README:
  402.  
  403.    DebugWindow is a utility that mimics the Windows 3.x program of the
  404. same name.
  405. It allows you to easily print out display strings during the
  406. development stages of
  407. your program without any of the headaches normally associated with
  408. built-in
  409. "standard I/O" functions.   
  410.  
  411.     DebugWindow's features:
  412.  
  413.  
  414.   •  full "printf()" functionality for C programmers without any added
  415. coding on
  416.       your part
  417.  
  418.   •  will remember its location and size on the screen across sessions
  419.  
  420.   •  no more hassles of trying to incorporate Think C's "stdio" window
  421.       in with your pure Toolbox code
  422.  
  423.   •  allows you to save any information that you've printed into its
  424. window to a
  425.       TeachText document 
  426.  
  427.   •  callable from either Think C or Hypercard
  428.  
  429. (Debug Window is written by Keith Ledbetter)
  430.  
  431. It's available in the usual Mac archive sites.
  432.  
  433. cheers,
  434. ______o0o______
  435.  Wayne Walrath
  436.  RFE/RL Inc.
  437.  
  438. ---------------------------
  439.  
  440. >From P.A.Brooks-Johnson@newcastle.ac.uk (P.A. Brooks-Johnson)
  441. Subject: Reducing screen flicker in simple animation.
  442. Date: Mon, 21 Feb 1994 13:17:13 GMT
  443. Organization: Computing Laboratory, U of Newcastle upon Tyne, UK NE1 7RU.
  444.  
  445.  
  446.  
  447. I'll make the apology first for this being a newbie question, but I'm in a bit of a time fix so I need some help. (and where better to look?)
  448.  
  449. A little background:
  450. I'm writing a simple algorithm animator for the Mac (and other platforms .....) I'm just moving simple rectangles round the screen so there's no need for complex animation stuff. Based on a book by Mark Watson ( Portable GUI development in C++) which IMO ain't bad, but is a bit buggy, I've got redraw etc to work OK. The problem is the screen flicker, mainly due, I guess, to constantly erasing and redrawing the object which are moving.
  451.  
  452. My solution:
  453. I propose to draw to an off screen grafPort then use copyBits to move the image from offScreen.portBits to screen.portBits.
  454.  
  455. The question:
  456. Very simple.... is this right?? Is the reduction in flicker worth the bother or shall I just spend my precious (no not precious, just very limited!) time on something else? Is there a better way? I get the impression qd provides some explicit support for this kind of thing.....
  457.  
  458. Thanks for your help, I may even understand all this one day!!!
  459.  
  460.  
  461. Peter
  462.  
  463. (P.A.Brooks-Johnson@newcastle.ac.uk)
  464.  
  465. +++++++++++++++++++++++++++
  466.  
  467. >From Michael Burks <mb1i+@andrew.cmu.edu>
  468. Date: Mon, 21 Feb 1994 11:07:53 -0500
  469. Organization: Fifth yr. senior, Math/Computer Science, Carnegie Mellon, Pittsburgh, PA
  470.  
  471. Excerpts from netnews.comp.sys.mac.programmer: 21-Feb-94 Reducing screen
  472. flicker in .. by P.A. Brooks-Johnson@newc
  473. > <How do I move rectangles around the screen without flicker deleted> 
  474. > My solution:
  475. > I propose to draw to an off screen grafPort then use copyBits to move
  476. the image 
  477. > from offScreen.portBits to screen.portBits.
  478. > The question:
  479. > Very simple.... is this right?? Is the reduction in flicker worth the
  480. bother or 
  481. > shall I just spend my precious (no not precious, just very limited!)
  482. time on som
  483. > ething else? Is there a better way? I get the impression qd provides
  484. some explic
  485. > it support for this kind of thing.....
  486. > Thanks for your help, I may even understand all this one day!!!
  487. What you propose will work.  I would call it psuedo-double bufferring. 
  488. It's a common thing.  Whether you want to do it is a very subjective
  489. question.
  490.  
  491. There are lots of other solutions.  If it's just rectangles, you could
  492. easily keep track of what pixels have changed yourself (this extends to
  493. polygons), and only update them.  You could also use color cycling
  494. (animating colors).
  495.  
  496. Blaine.
  497.  
  498. +++++++++++++++++++++++++++
  499.  
  500. >From Sander C. Temme <temme@phys.uva.nl>
  501. Date: 22 Feb 94 14:00:18 +0100
  502. Organization: University of Amsterdam
  503.  
  504.  
  505.  
  506. In article <CLKswq.B8y@newcastle.ac.uk> P.A. Brooks-Johnson,
  507. P.A.Brooks-Johnson@newcastle.ac.uk writes:
  508. >The question:
  509. >Very simple.... is this right?? Is the reduction in flicker worth
  510. the bother or 
  511. >shall I just spend my precious (no not precious, just very
  512. limited!) time on 
  513. >something else? Is there a better way? I get the impression qd
  514. provides some 
  515. >explicit support for this kind of thing.....
  516. The easiest way to do this is documented in the acclaimed book 'How
  517. to Write Macintosh Software' by Scott Knaster as 'Smooth Animation
  518. for the Rest of Us': 
  519.  
  520. You can synchronize your drawing with the vertical retrace (i.e.
  521. when the electron beam moves from lower right corner to upper left
  522. corner of the screen) so you change the video RAM when no drawing is
  523. going on. When the Mac hits vertical retrace, it generates an
  524. interrupt. One of the things this interrupt does is increase the
  525. TickCount global Variable. So, what the rest of us do to get smooth
  526. animation is let our program sit in a tight loop waiting for
  527. TickCount to change, and when it does, draw like heck. 
  528. Only, this method dates from way back when multiple screens and
  529. CQuickDraw weren't an issue. You'll have to see whether it still
  530. works. When it did (when I toyed around with simple animation on a
  531. Plus), it gave nice results for all its simplicity. 
  532.  
  533. >
  534. >Thanks for your help, I may even understand all this one day!!!
  535. (-: (-:
  536.  
  537. Sander
  538.  
  539.  
  540. Sander C. Temme, University of Amsterdam, Holland temme@phys.uva.nl
  541. -------------------------------------------------------------------
  542. 'Denkt U werkelijk dat wij zo gek zijn om voor een weddenschap naar 
  543. Zuid-Afrika te vliegen?'
  544.                          -- Bob Evers
  545.  
  546. +++++++++++++++++++++++++++
  547.  
  548. >From mssmith@afterlife.ncsc.mil (M. Scott Smith)
  549. Date: Tue, 22 Feb 1994 17:22:35 GMT
  550. Organization: The Great Beyond
  551.  
  552. In article <1994Feb22.140018.4396@news.sara.nl> Sander C. Temme <temme@phys.uva.nl> writes:
  553. >
  554. >You can synchronize your drawing with the vertical retrace (i.e.
  555. >when the electron beam moves from lower right corner to upper left
  556. >corner of the screen) so you change the video RAM when no drawing is
  557. >going on. When the Mac hits vertical retrace, it generates an
  558. >interrupt. One of the things this interrupt does is increase the
  559. >TickCount global Variable. So, what the rest of us do to get smooth
  560. >animation is let our program sit in a tight loop waiting for
  561. >TickCount to change, and when it does, draw like heck. 
  562. >Only, this method dates from way back when multiple screens and
  563. >CQuickDraw weren't an issue. You'll have to see whether it still
  564. >works. When it did (when I toyed around with simple animation on a
  565. >Plus), it gave nice results for all its simplicity. 
  566. >
  567.  
  568.    Unfortunately this method doesn't work anymore, at least not for color
  569. monitors.
  570.  
  571.    The global variable "TickCount" has traditionally been updated every
  572. 1/60 of a second -- which was nicely in sync with the refresh rate on the
  573. old black and white Mac monitors.
  574.  
  575.    On color monitors, the refresh rate is rarely 60 hz., and even if it
  576. is, there's no real guarantee that it's going to be perfectly in sync
  577. with TickCount.
  578.  
  579.    What you need to do, then, is "sync up" with whatever monitor happens
  580. to be attached to the Mac.  How do you do this?  Well, luckily there's
  581. sample code floating around to do just this.  I know Mike Kelly has
  582. written some (I haven't seen him around much; must be busy with his
  583. newfound success!  :), and I believe there's some code in the Mac
  584. programming FAQ which you can download from sumex-aim.stanford.edu
  585. (among places).  Several other people have written sample code to do
  586. it.  (I'm sure Jon Witte has.)  It's not particularly friendly code,
  587. and most implementations I've seen use some assembly language.
  588.  
  589.    Just synching to the monitor isn't a full solution, however.  For
  590. this method to work as expected, you need to be sure that you can get
  591. all your drawing done in less than one screen refresh -- typically
  592. somewhere around 1/60th -> 1/70th of a second.  If it takes 1.5 screen
  593. updates to do your drawing, you're not necessarily gaining much by
  594. synching.  (I haven't done much testing so I can't say if you're better
  595. off synching than not in situations like this.  In any case, synching
  596. will almost always have the effect of slowing down your animation -- after
  597. all, you'll be spending time waiting around for that electron gun to get
  598. to the top of the screen.  I wrote a screen saver that simply animates
  599. a sphere bouncing around the screen.  I wrote directly to video RAM,
  600. and used a number of other tricks to make it as quick as possible.  The
  601. result was mind-numbingly fast animation -- the ball ricocheted (sp?) back
  602. and forth faster than the eye could see.  When I added synching, the ball
  603. moved pretty slowly -- very smoothly, yes, but it was now animating one
  604. frame in the time it was doing 40 or more before.  So, in some cases,
  605. you might want that "non-smooth" effect which you get with high-frame-rate
  606. animation.  But I digress..)
  607.  
  608.    The method you use to draw to the screen will greatly affect how much
  609. time it takes.  I didn't catch your original message, so I'm not sure
  610. if you're aware that "offscreen buffers" are the best way to achieve
  611. smooth animation.  If you're not familiar with their definition or use,
  612. I'd be happy to explain them to you.
  613.  
  614.    You generally do all of your drawing "offscreen", and copy your picture
  615. to the screen (via CopyBits or writing directly to the video RAM or
  616. directly into a PixMap, etc.) only once it's completely ready.  It's
  617. much quicker to write offscreen and the user doesn't see the individual
  618. pieces of the picture being painted, etc., which can look really bad if
  619. done on-screen.
  620.  
  621.    Well, this has been somewhat of a cluttered message but I hope you
  622. got something out of it.  Check out the programming FAQ's -- they should
  623. have information on "monitor-independent" synching, which is one step
  624. towards smooth animation.  And if you're not familiar with offscreen
  625. drawing, you'll want to look into GWorlds, which are probably the most
  626. painless way to do it.  (Plus you'll want to look around for some theory
  627. on how to best use offscreen environments -- I've seen lots of different
  628. methods, and I suppose which one you choose depends on your specific
  629. application.)
  630.  
  631.    If you're going to be doing intensive-graphics-therapy in your game/
  632. program/whatever, you might wish to look into (gasp!) drawing directly to
  633. the screen.  CopyBits is an incredibly versatile tool, but that versatility
  634. adds some overhead in many situations; it may not be the best choice
  635. for arcade-style animation.
  636.  
  637.    On that note, here's a question for those of you in the know -- I haven't
  638. had a chance to play around with the PPC much; is direct-screen drawing (if
  639. done properly) still functional with the PowerPC's?
  640.  
  641.    I've constructed a C++ "direct-screen" library which takes a lot of
  642. the pain out of direct screen drawing, I might get around to polishing
  643. it up and releasing it some day.
  644.  
  645.    Good luck!  Executing animation properly can make a big difference
  646. in the appearance of your program.  It's worth it to spend the time
  647. researching -- there's a lot to learn.
  648.  
  649. Later,
  650.  
  651. M. Scott Smith
  652.  
  653.  
  654. +++++++++++++++++++++++++++
  655.  
  656. >From john_werner@taligent.com (John Werner)
  657. Date: Tue, 22 Feb 1994 16:58:02 GMT
  658. Organization: Taligent, Inc.
  659.  
  660. In article <1994Feb22.140018.4396@news.sara.nl>, Sander C. Temme
  661. <temme@phys.uva.nl> wrote:
  662.  
  663. > You can synchronize your drawing with the vertical retrace
  664. > ....
  665. > interrupt. One of the things this interrupt does is increase the
  666. > TickCount global Variable. So, what the rest of us do to get smooth
  667. > animation is let our program sit in a tight loop waiting for
  668. > TickCount to change
  669.  
  670. This ceased to be true in 1987 with the advent of the Mac II.  On machines
  671. with Color Quickdraw, the global TickCount counter is not necessarily tied
  672. to the refresh rate on any particular monitor.  TickCount is increment 60
  673. times a second, while the refresh rate on most monitors these days is in
  674. the 65-75 Hz range.
  675.  
  676. There's still a way to get what you want, however.  You need to figure out
  677. which screen your window is (mostly) on, by looping through all the screen
  678. devices with routines like GetNextDevice.  Then you find the slot number
  679. for that device and install your VBL task with SlotVInstall.
  680.  
  681. I have a TCL class that does all this in the TCL archives at brown.edu. 
  682. You won't be able to use the code unless you're writing a TCL app, but it
  683. might help you get started.  The class is called CVblSync or some such
  684. thing.
  685.  
  686. -- 
  687. John Werner                           john_werner@taligent.com  
  688. Taligent, Inc.
  689.  
  690. +++++++++++++++++++++++++++
  691.  
  692. >From Arsenault_C@msm.cdx.mot.com (Chris Arsenault)
  693. Date: Tue, 22 Feb 1994 12:58:35 -0500
  694. Organization: Motorola Codex
  695.  
  696. In article <CLKswq.B8y@newcastle.ac.uk>, P.A.Brooks-Johnson@newcastle.ac.uk
  697. (P.A. Brooks-Johnson) wrote:
  698.  
  699. > The problem is the screen flicker, mainly due, I guess, to constantly erasing and redrawing the object which are moving.
  700. > My solution:
  701. > I propose to draw to an off screen grafPort then use copyBits to move the image from offScreen.portBits to screen.portBits.
  702.  
  703. This is great if you have a lot of internal animation to deal with (like a
  704. figure walking while moving across the screen).  It may not be necessary if
  705. you're doing something simple like drawing solid color rects on the screen.
  706. There are several possible ways to reduce flickering animation, and they
  707. may be combined:
  708.  
  709.  - use the VBL to sync so you draw only during vertical retrace.  This
  710. gives you the best results. You can loop and wait for the retrace by
  711. watching ticks. Try to write your function so you can handle events etc
  712. while waiting for vertical retrace to come around. The trick here is arrive
  713. at the draw function with very few ticks to waste.  You can also install a
  714. VBL task to perform the drawing (just don't allow Memory Mgr memory moves
  715. to occur during the interrupt) Make sure you switch the saved screen port
  716. in before drawing. Provided you're just doing a minimal amount of drawing
  717. this will work nicely.
  718. There is a couple of things you should be aware of when using VBL sync for
  719. drawing - in general it works, but on various monitors (which use different
  720. refresh rates) it's not always flicker-free.  Getting good results in that
  721. situation is a whole book in itself.
  722.  
  723. - queue up all your drawing objects (prepare a draw list) ahead of time. 
  724. When you get the VBL sync all you do is draw - fast.  This means you don't
  725. combine calculations with drawing time. Do all your calculations while the
  726. user is looking at the last image.
  727.  
  728.  - calculate minimum update rects for each moving object on screen. Just
  729. determine the deltas between where the old image was drawn and where the
  730. new one needs to be, then draw that. For example if I have a rectangle
  731. moving horizontally across the screen, all I have to erase is the
  732. difference of the move, and draw the move difference on the other side.
  733. (Erase a small rectangle on one side and draw a small rectangle on the
  734. other)  This works best when you have solid colors to animate, and the size
  735. and number of rectangles justifies the overhead for the calls and
  736. calculations. This technique is great for flight simulators where you have
  737. to do polygon manipulation and provide really fast frame rates.
  738.  
  739. - buffered offscreen minimal update. When you have a number of different
  740. objects moving around the screen and you'll be spending more time either
  741. trying to grab the video card (NuBus) or trying to restore a background,
  742. create an offscreen port and do your drawing there. The area that you want
  743. to draw to the screen is the union of the previously drawn rect and the
  744. union of all the new rects to draw. Create the drawing list, restore
  745. background or previous,  draw all the rects over this , then wait for VBL,
  746. then CopyBits the offscreen image (just the minimal update union rect) to
  747. the screen.
  748.  
  749. - color cycle animation can be really quick, but animating colors are best
  750. used inside some other image which is copyed to the screen via one of the
  751. methods suggested above. 
  752. I tried to do a simple scrolling effect using color cycling behind moving
  753. images, it looked okay, but called for more color management overhead than
  754. the effect was  worth.
  755.  
  756. Hope this helps,
  757. Chris
  758.  
  759. -- 
  760. #include <UsualLegalDisclaimers.h>
  761.  
  762. +++++++++++++++++++++++++++
  763.  
  764. >From s_heidri@iraul1.ira.uka.de (Dietmar Heidrich)
  765. Date: 28 Feb 1994 14:54:15 GMT
  766. Organization: University of Karlsruhe, FRG
  767.  
  768.  
  769. As a visitor to this group, I'd like to know if there is
  770. double-buffering for the Mac, meaning you can draw in the
  771. background and display a foreground screen and exchange both
  772. at vertical blank.  This is the best technique for providing
  773. smooth animation.
  774.  
  775. Now: Is this possible with the Mac toolbox ?  I could not find
  776. anything about it in the Inside MacIntosh books.
  777.  
  778. Personal mail preferred, as I don't read this group.  Of course,
  779. you may also reply in public and PM.
  780.  
  781. Thanks.
  782.  
  783.  
  784.  
  785. --
  786. Dietmar Heidrich, Universitaet Karlsruhe, Germany
  787.  
  788.  
  789. "Die Hoffnung auf den Tod ist das einzige, was mich am Leben erhaelt."
  790.  
  791. ---------------------------
  792.  
  793. >From partingt@fwi.uva.nl (Vincent Partington)
  794. Subject: What to say when the appropiate Gestalts aren't there?
  795. Date: 23 Feb 1994 11:11:23 GMT
  796. Organization: FWI, University of Amsterdam
  797.  
  798. Hi!
  799.  
  800. Apple advises developers to check the Gestalt-selectors to determine of
  801. certain System features are available instead of checking for System version.
  802. In my Sys7-only app (supporting Sys6 is just too cumbersome because about half
  803. of my systemcalls are Sys7-ones in my not-too-big app) I first check for
  804. the availability of Gestalt and then check all kinds of Gestalt-selectors
  805. for stuff like FSSpec-calls, new Standard File calls, Alias Manager, etc, etc.
  806.  
  807. When I don't find those features I will have to let the user know and will have
  808. to pop up an alert telling him to upgrade or die. What should this alert say?
  809. Saying "You'll have to upgrade to Sys7 or later" is contradictory to checking
  810. Gestalt because Sys8 may not have the FSSpec-calls (small chance).
  811. Saying "You'll have to upgrade to System 7.1.6" (which I use) would be
  812. weird if Sys8 can do everything Sys7.1.6 can.
  813. Saying "Get a system thet has the Gestalt-trap, returns a 1 in bits 0 and 1 of
  814. the return from Gestalt-selector for the file system, returns 1 in bit 0 of
  815. the returnvalue from Gestalt-selector...etc...etc." would be rather
  816. user-unfriendly.
  817.  
  818. Any comment?
  819.  
  820. Vincent.
  821. -- 
  822. BLABLABLABLABLABLABLABLABLABLABLABLABLABLABLA   Internet : partingt@fwi.uva.nl
  823. BLABLA 68040 Power! ABLABLABLABLABLABLABLABLA              vincent@tnc.nl
  824. BLABLABLABLABLABLABLABLABLABLABLABLABLABLABLA   FidoNet  : 2:281/202.15
  825. BLABLABLABLABLABLABLABLABLABLABLABLABLABLABLA   NeST     : 90:500/202.15
  826.  
  827. +++++++++++++++++++++++++++
  828.  
  829. >From hrafal@copernicus.bbn.com (Howie Rafal)
  830. Date: 23 Feb 1994 19:31:09 GMT
  831. Organization: BBN, Inc
  832.  
  833. In article <2kfdkr$ki1@hermes.fwi.uva.nl>, partingt@fwi.uva.nl (Vincent
  834. Partington) wrote:
  835. > When I don't find those features I will have to let the user know and will 
  836. > have
  837.  
  838. You could first check what version of the system is running and give the
  839. version  message if it applies.  Otherwise, If the system version is 7.x or
  840. greater, explain that certain necessary features are missing from the
  841. Macintosh and then give a list box of the missing managers (if they care). 
  842. This would be better than listing just one manager is missing.  They could
  843. then upgrade as needed.
  844.  
  845. +++++++++++++++++++++++++++
  846.  
  847. >From Pascal_Haakmat
  848. Date: Wed, 23 Feb 94 20:08:28 +0100
  849. Organization: (none)
  850.  
  851.  VP> What should this alert say?
  852.  
  853. Well, be honest with the user, tell him what's going on ...
  854.  
  855. Like: "Your system does not support the required FSSpec File Manager
  856. calls."
  857. If Gestalt returns a system version < 7 you might add "You should
  858. upgrade to System 7."
  859.  
  860.  
  861.  
  862.     Pascal.
  863.  
  864. --- Obolus 1.0.2
  865.  * Origin:  go on upstairs with your sweet little wishes  (2:281/202.13)
  866.  
  867. +++++++++++++++++++++++++++
  868.  
  869. >From wdh@netcom.com (Bill Hofmann)
  870. Date: Fri, 25 Feb 1994 18:20:07 GMT
  871. Organization: NETCOM On-line Communication Services (408 241-9760 guest)
  872.  
  873. Pascal_Haakmat writes:
  874. > VP> What should this alert say?
  875. >Well, be honest with the user, tell him what's going on ...
  876. >Like: "Your system does not support the required FSSpec File Manager
  877. >calls."If Gestalt returns a system version < 7 you might add "You should
  878. >upgrade to System 7."
  879. Or, perhaps, "_MakeFSSpec is not available." :->  Better yet, explain in
  880. details that are useful to the typical user:
  881.     "<This Program> requires System 7 or later."
  882. or
  883.     "<This program> requires a floating point unit."
  884. or
  885.     "<This program> requires color support (Mac II or better)."
  886. If you really think the user wants to know which particular feature
  887. isn't available, encode it as a little digit somewhere, and put it in
  888. the documentation.  Since one can't get the revised file manager
  889. *without* System 7, telling them they need it won't really help them
  890. solve their problem.
  891. -- 
  892. -Bill Hofmann                    wdh@netcom.COM
  893.  Fresh Software and Instructional Design    +1 510 524 0852
  894.  
  895. +++++++++++++++++++++++++++
  896.  
  897. >From gurgle@netcom.com (Pete Gontier)
  898. Date: Sat, 26 Feb 1994 22:34:34 GMT
  899. Organization: cellular
  900.  
  901. wdh@netcom.com (Bill Hofmann) writes:
  902.  
  903. >the documentation.  Since one can't get the revised file manager
  904. >*without* System 7, telling them they need it won't really help them
  905. >solve their problem.
  906.  
  907. Untrue. One can get it with QuickTime. I'm not sure if the Gestalt
  908. selector gets installed, though. I believe you have to test for
  909. QuickTime *or* the new File Manager calls, and then use the subset of
  910. the new File Manager calls which are in QuickTime.
  911.  
  912. This is a thorny problem, and in general I think you are right to
  913. suggest that the message talk about System 7 instead of the new File
  914. Manager calls, but in this particular case, there is a solution other
  915. than System 7. It's hard to know what to put in the message.
  916. -- 
  917.  Pete Gontier, CTO, Integer Poet Software; gurgle@netcom.com
  918.  
  919. +++++++++++++++++++++++++++
  920.  
  921. >From rgaros@bio.vu.nl (Rene G.A. Ros)
  922. Date: Sun, 27 Feb 1994 09:17:37 GMT
  923. Organization: VU Biology, Amsterdam, The Netherlands
  924.  
  925. gurgle@netcom.com (Pete Gontier) writes:
  926. : wdh@netcom.com (Bill Hofmann) writes:
  927. : >the documentation.  Since one can't get the revised file manager
  928. : >*without* System 7, telling them they need it won't really help them
  929. : >solve their problem.
  930. : Untrue. One can get it with QuickTime. I'm not sure if the Gestalt
  931. : selector gets installed, though. I believe you have to test for
  932. : QuickTime *or* the new File Manager calls, and then use the subset of
  933. : the new File Manager calls which are in QuickTime.
  934.  
  935. >From my Suppl. Gestalt Selectors list:
  936.  
  937. QuickTime
  938. ---------
  939. If you install QuickTime under System 6, a major portion of the Alias
  940. Manager and FSSpec support is also added. But, QT doesn't implement the
  941. Gestalt selectors because the implementation is not complete. You must
  942. check for either Alias Mgr or QuickTime. (Michael Hecht)
  943. If QuickTime is present, assume you have an Alias Manager, subject to some
  944. limitations (NewAliasMinimalFromFullPath not present). Nearly all the
  945. FSSpec calls are available (except FSpExchangeFiles) in System 6 when
  946. QuickTime is installed. See for more information Technical Note
  947. M.QT.MovieTB.Q&As (QT 510).
  948.  
  949.  
  950. Regards,
  951. Rene
  952. -- 
  953.  
  954. --------------------------------------------------------------------------------
  955.   Rene G.A. Ros                                      Amsterdam, The Nederlands
  956.   rgaros@bio.vu.nl         rgaros@nikhefk.nikhef.nl          rener@htsa.aha.nl
  957.  
  958. +++++++++++++++++++++++++++
  959.  
  960. >From partingt@fwi.uva.nl (Vincent Partington)
  961. Date: 27 Feb 1994 15:21:01 GMT
  962. Organization: FWI, University of Amsterdam
  963.  
  964. rgaros@bio.vu.nl (Rene G.A. Ros) writes:
  965.  
  966. >QuickTime
  967. >---------
  968. >If you install QuickTime under System 6, a major portion of the Alias
  969. >Manager and FSSpec support is also added. But, QT doesn't implement the
  970. >Gestalt selectors because the implementation is not complete. You must
  971. >check for either Alias Mgr or QuickTime. (Michael Hecht)
  972. >If QuickTime is present, assume you have an Alias Manager, subject to some
  973. >limitations (NewAliasMinimalFromFullPath not present). Nearly all the
  974. >FSSpec calls are available (except FSpExchangeFiles) in System 6 when
  975. >QuickTime is installed. See for more information Technical Note
  976. >M.QT.MovieTB.Q&As (QT 510).
  977.  
  978. What a shame, no FSpExchangeFiles! That's the one I really like about the
  979. new calls. Well, I think assuming the FSSpec calls are then when QuickTime is,
  980. is weird anyway, so I wouldn't have checked one way or another.
  981. I really like a lot of other things about Sys7 too: Alias Manager, Find Folder,
  982. Popup CDEF, Apple Events, Notification manager, Temporary Memory (OK,
  983. MultiFinder has it too, but not "real" temp mem), CustomGetFile, so supporting
  984. Sys6 would be a real drag.
  985.  
  986. Vincent.
  987. -- 
  988. VI is better than Emacs.      | Let's     | Internet : partingt@fwi.uva.nl
  989. MacOS is better than Windows. | start the |            vincent@tnc.nl
  990. Unix is better than VMS.      | religious | FidoNet  : 2:281/202.15
  991. Eiffel is better than C++.    | war!!     | NeST     : 90:500/202.15
  992.  
  993. +++++++++++++++++++++++++++
  994.  
  995. >From ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  996. Date: 28 Feb 94 16:30:50 +1300
  997. Organization: University of Waikato, Hamilton, New Zealand
  998.  
  999. In article <gurgleCLus1o.4EK@netcom.com>, gurgle@netcom.com (Pete Gontier) writes:
  1000. > wdh@netcom.com (Bill Hofmann) writes:
  1001. >
  1002. >>the documentation.  Since one can't get the revised file manager
  1003. >>*without* System 7, telling them they need it won't really help them
  1004. >>solve their problem.
  1005. >
  1006. > Untrue. One can get it with QuickTime. I'm not sure if the Gestalt
  1007. > selector gets installed, though. I believe you have to test for
  1008. > QuickTime *or* the new File Manager calls, and then use the subset of
  1009. > the new File Manager calls which are in QuickTime.
  1010. >
  1011. > This is a thorny problem, and in general I think you are right to
  1012. > suggest that the message talk about System 7 instead of the new File
  1013. > Manager calls, but in this particular case, there is a solution other
  1014. > than System 7. It's hard to know what to put in the message.
  1015.  
  1016. My ad hoc, informal guideline, which I just thought up off the top of my
  1017. head, is "explain just the simplest case". If you need the new File Manager
  1018. calls, then I personally would just say "I need System 7 or later". If in
  1019. fact the program can be made to work under 6.0.7 with QuickTime installed,
  1020. then you can explain that in the documentation somewhere, or as an answer
  1021. to a tech support question. Don't try to burden your compatibility messages
  1022. with all the possible situations. It's less confusing that way.
  1023.  
  1024. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  1025. Info & Tech Services Division              fax: +64-7-838-4066
  1026. University of Waikato            electric mail: ldo@waikato.ac.nz
  1027. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
  1028. "Classical Paintings: DaVinci, Degauss, Rembrant, Van Gogh and more! View
  1029. the works of history's finest artists."  -- ad quoted in PC Magazine
  1030.  
  1031. +++++++++++++++++++++++++++
  1032.  
  1033. >From alana@cs.uoregon.edu (Alan Akins)
  1034. Date: 28 Feb 1994 08:24:00 -0800
  1035. Organization: The uncharted backwaters of the unfashionable end of the                  Western Spiral arm of the Galaxy.
  1036.  
  1037. In article <1994Feb27.091737.5150@bio.vu.nl>,
  1038. Rene G.A. Ros <rgaros@bio.vu.nl> wrote:
  1039.  
  1040. >If you install QuickTime under System 6, a major portion of the Alias
  1041. >Manager and FSSpec support is also added. But, QT doesn't implement the
  1042. >Gestalt selectors because the implementation is not complete. You must
  1043. >check for either Alias Mgr or QuickTime. (Michael Hecht)
  1044. >If QuickTime is present, assume you have an Alias Manager, subject to some
  1045. >limitations (NewAliasMinimalFromFullPath not present). Nearly all the
  1046. >FSSpec calls are available (except FSpExchangeFiles) in System 6 when
  1047. >QuickTime is installed. See for more information Technical Note
  1048. >M.QT.MovieTB.Q&As (QT 510).
  1049.  
  1050. Is this still true of QuickTime 2.0? Have they "completed" the implementation?
  1051.  
  1052. /Alan\
  1053. -- 
  1054. *      "Evan's been doing parallel       |    Alan Akins                      *
  1055. *           processing for so long...    |    alana@cs.uoregon.edu            *
  1056. *                 he's beside himself."  |    University of Oregon            *
  1057. *                        - Me            |    Department of Computer Science  *
  1058.  
  1059. +++++++++++++++++++++++++++
  1060.  
  1061. >From rgaros@paramount.nikhefk.nikhef.nl (Rene Ros)
  1062. Date: Mon, 28 Feb 1994 17:52:43 GMT
  1063. Organization: NIKHEFK
  1064.  
  1065. alana@cs.uoregon.edu (Alan Akins) writes:
  1066. : In article <1994Feb27.091737.5150@bio.vu.nl>,
  1067. : Rene G.A. Ros <rgaros@bio.vu.nl> wrote:
  1068. : >If you install QuickTime under System 6, a major portion of the Alias
  1069. : >Manager and FSSpec support is also added. But, QT doesn't implement the
  1070. : >Gestalt selectors because the implementation is not complete. You must
  1071. : >check for either Alias Mgr or QuickTime. (Michael Hecht)
  1072. : >If QuickTime is present, assume you have an Alias Manager, subject to some
  1073. : >limitations (NewAliasMinimalFromFullPath not present). Nearly all the
  1074. : >FSSpec calls are available (except FSpExchangeFiles) in System 6 when
  1075. : >QuickTime is installed. See for more information Technical Note
  1076. : >M.QT.MovieTB.Q&As (QT 510).
  1077. : Is this still true of QuickTime 2.0? Have they "completed" the implementation?
  1078.  
  1079. Don't shoot the messenger! :-)
  1080. I have no idea if QT 2.0 implements the Alias Mgr and FSSpec calls. Would be
  1081. nice, the gestalt selectors should then be installed also. So, simple
  1082. check for the selectors now and perhaps you will support System 6/QT in the
  1083. future?
  1084. I myself use two procedures to determine if the Alias Mgr is partially or
  1085. fully installed. Where I use the 'qtim' selector to see if it is partiallu
  1086. installed. 
  1087. If someone has anymore info about this regarding QT 2.0 I would like to
  1088. know. Or has someone the email address of 'the powers that be' at Apple? :-)
  1089. The prese release didn't say anything about it, which doesn't surprise me.
  1090.  
  1091. Rene
  1092.  
  1093.  
  1094. +++++++++++++++++++++++++++
  1095.  
  1096. >From bc@wetware.com (monsieur HAINEUX)
  1097. Date: Tue, 1 Mar 1994 00:45:14 GMT
  1098. Organization: /usr/local/lib/rn/organization
  1099.  
  1100. The problem with configuration problems is that most users will need
  1101. more explanation than you can fit in a dialog box. Even if you can fit
  1102. the whole explanation in a dialog box, most users will forget what the
  1103. dialog says as soon as it's gone, or see all those words and call Tech
  1104. Support before thinking anything through.
  1105.  
  1106. The trick is to explain the situation in a pithy, easily-memorable way
  1107. in the dialog, then explicitly point to the documentation for further
  1108. explanation.
  1109.  
  1110. For example:
  1111.  
  1112. (STOP)    Missing resources: <MyApp> cannot launch.
  1113.  
  1114.     Some necessary resources are not present in your
  1115.     Macintosh. Please check the "Configuration Requirements"
  1116.     section in your <MyApp> manual.
  1117.  
  1118.     ErrNo: <12345>            (Quit)
  1119.  
  1120. (STOP)    No Color Available: <MyApp> cannot launch.
  1121.  
  1122.     <MyApp> cannot find a color screen connected to your
  1123.     Macintosh. Please chek the "Configuration Requirements"
  1124.     section in your <MyApp> Manual.
  1125.  
  1126.     ErrNo: <12347)            (Quit)
  1127.     
  1128. It's up to you to provide the documentation that explains the whole
  1129. deal. For example, the documentation might read:
  1130.  
  1131. CONFIGURATION REQUIREMENTS
  1132.     <MyApp> requires a Mac Minus or better to run, System 7.0 or
  1133.     newer, 4 bit color, 437 MB of RAM memory, and 34K of disk
  1134.     space (minimum). We recommend for best performance, however, that
  1135.     you turn off virtual memory and make sure your entire hard
  1136.     disk is blank.
  1137.  
  1138.     If your Mac doesn't have enough memory, throw it away and buy
  1139.     a new one. If it has the required memory, but <MyApp> still
  1140.     won't launch, try turning off memory-using INITs, quitting
  1141.     other apps, and waving a dead chicken over it.
  1142.  
  1143. NOTE:
  1144.     Technically advanced users may be able to run <MyApp> by
  1145.     installing GreedManager 3.17 and FondleMonger 1.0d127c23 on
  1146.     System 6.x. If you would like support on how to set up this
  1147.     configuration, kindly submit your request on the back of a
  1148.     hundred-dollar bill to:...
  1149.  
  1150. Later, in the appendix on Error Numbers, you have your choice. If you
  1151. want to reserve a whole suite of errnos for launch fail, you can have
  1152. separate messages in the index:
  1153.  
  1154. ERNO    Explanation
  1155. 12345    GreedManager is missing. See "REQUIREMENTS" section of manual.
  1156. 12346    FondleMonger is missing. See "REQUIREMENTS" section of manual.
  1157.  
  1158. Or you can have just one:
  1159.  
  1160. ERRNO    Explanation
  1161. 12345    Mac does not meet minimum configuration requirements. See
  1162.     "REQUIREMENTS" section of manual.
  1163.  
  1164. bill coderre
  1165.  
  1166. ---------------------------
  1167.  
  1168. >From Joshua Joseph Marks <jmb1+@andrew.cmu.edu>
  1169. Subject: small snag
  1170. Date: Mon, 28 Feb 1994 18:43:17 -0500
  1171. Organization: Junior, Math/Computer Science, Carnegie Mellon, Pittsburgh, PA
  1172.  
  1173. I have this one problem that is probably linked to not being familiar
  1174. with writing code on the MAcintosh, or it could be just a big oversite.
  1175.  
  1176. I have a structure defined as:
  1177. struct branch
  1178. {
  1179.     short type,xi,yi;
  1180. }
  1181.  
  1182.  
  1183. when running through the following code I get a BUS ERROR
  1184.  
  1185. struct element *Init_Branch (short x, short y, float direction, short length)
  1186. {
  1187.     struct element *new_element;
  1188.     
  1189.     new_element = (struct element*) malloc (sizeof (struct element));
  1190.     if (new_element == NIL) ExitToShell();
  1191.  
  1192.     new_element->xi = x_start;    
  1193.     new_element->yi = y_start;
  1194.     new_element->type = BRANCH_LENGTH; ....
  1195.  
  1196.  
  1197. The problem is of course the malloc, which screws everything up when it
  1198. gets two lines later.  I cant seem to trace where the problem is.  I
  1199. have the struct defined in a seperate header file that is included at
  1200. the top, and I have a the segments placed so that 2 contains ANSI and
  1201. the main portion, and 3 contains MacTraps and all suboordinate
  1202. proceddures.  Does the way you segment things matter?  Does ANSI have to
  1203. be somewhere.  Thanks for any suggestions and thanks doubly for
  1204. solutions.
  1205.                                                             Josh
  1206.  
  1207.  
  1208. +++++++++++++++++++++++++++
  1209.  
  1210. >From mssmith@afterlife.ncsc.mil (M. Scott Smith)
  1211. Date: Tue, 1 Mar 1994 01:19:14 GMT
  1212. Organization: The Great Beyond
  1213.  
  1214. In article <IhQc6Jy00WBMA_Tkot@andrew.cmu.edu> Joshua Joseph Marks <jmb1+@andrew.cmu.edu> writes:
  1215. >I have this one problem that is probably linked to not being familiar
  1216. >with writing code on the MAcintosh, or it could be just a big oversite.
  1217. >
  1218. > (problem described)
  1219. >
  1220. >The problem is of course the malloc, which screws everything up when it
  1221. >gets two lines later.  I cant seem to trace where the problem is.  I
  1222. >have the struct defined in a seperate header file that is included at
  1223. >the top, and I have a the segments placed so that 2 contains ANSI and
  1224. >the main portion, and 3 contains MacTraps and all suboordinate
  1225. >proceddures.  Does the way you segment things matter?  Does ANSI have to
  1226. >be somewhere.  Thanks for any suggestions and thanks doubly for
  1227. >solutions.
  1228. >                                                            Josh
  1229. >
  1230.  
  1231. Josh,
  1232.  
  1233.    I'm going to take a very wild guess of what *might* be your problem,
  1234. without studying your code too much.
  1235.  
  1236.    If you're not including <stdlib.h>, MAKE SURE you do.  At the start of
  1237. your program, do this:
  1238.  
  1239. #include <stdlib.h>
  1240.  
  1241.    If you're not doing this, then I'd suspect that's your problem, because
  1242. I've had the same problem in the past.  If I recall correctly, there's
  1243. a couple different versions of malloc out there, and unless you include
  1244. stdlib.h you're not getting the right one.  (I forget the exact
  1245. reasoning behind this.)  The standard libraries reference for Think C
  1246. (as well as Think Reference 2.0 database module included w/Think C v6.0x)
  1247. mentions that "if you have any problems with malloc(), make sure you
  1248. #included stdlib.h in your source file.  I believe it.
  1249.  
  1250.    So definitely do that if you aren't.  If you are, well, umm, uhh..
  1251. Sorry to have gotten your hopes up.
  1252.  
  1253.    But to answer some of your questions, no, it doesn't matter how you
  1254. segment things.  Segments are transparent to the programmer, although
  1255. if you know what you're doing you can fool around with placement of
  1256. files in the segment to speed up programs.  (For example, code segments
  1257. are loaded into memory one at a time.  You can "pre-load" segments that
  1258. contain frequently-used code.  You might toss code that prints a document
  1259. in a separate code segment that you don't preload, since users don't
  1260. print documents that much.  When the user does print the document, there
  1261. might be a pause as that segment is loaded from disk.)  BUT, all of this
  1262. is transparent to you.  It's all memory management magic.
  1263.  
  1264.    You'll also benefit from learning about NewPtr and NewHandle, which are
  1265. the "cool" ways of allocating memory on the Macintosh.  Lots of people have
  1266. problems with the ANSI routines.  But few people use them.  Most people
  1267. use the Mac-specific routines, and few people have problems with them.
  1268. (Huh?)  :)
  1269.  
  1270.    Don't take too much faith in this, but this is how you can allocate
  1271. structures using the Mac's NewPtr routine:  (borrowed partially from Think
  1272. Ref)
  1273.  
  1274. struct MyStruct
  1275. {
  1276.   short  tall;
  1277. }
  1278.  
  1279. struct MyStruct *myStructPtr;
  1280.  
  1281. myStructPtr = (struct myStruct *)NewPtr(sizeof(MyStruct));
  1282.  
  1283. then you can do..
  1284.  
  1285. x = myStructPtr->tall;
  1286.  
  1287.    And you'll eventually probably want to use Handles, but those can be
  1288. tricky and I won't go into them now.
  1289.  
  1290. Good luck!  (And I hope the <stdlib.h> is all you need..)
  1291.  
  1292. Scott
  1293.  
  1294. ---
  1295. M. Scott Smith    (mssmith@afterlife.ncsc.mil || umsmith@mcs.drexel.edu)
  1296.  
  1297.    Macintosh developer. Ski bum. Student.  Eater of Cadbury Creme Eggs.
  1298.  
  1299.  
  1300. ---------------------------
  1301.  
  1302. End of C.S.M.P. Digest
  1303. **********************
  1304.  
  1305.  
  1306.  
  1307.